package com.bw.demo_flow

import android.util.Log
import androidx.lifecycle.ViewModel
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.flow

/**
 * @Author : ZhouZiYao
 * @Time : On 2023/11/15 11:23
 * @Description :
 */
class MyViewModel: ViewModel() {
    var timeFlow = flow {
        var time = 0
        while (true) {
            Log.d("TAG", "$time")
            emit(time)
            delay(1000)
            time++
        }
    }

    var timeFlow2 = flow {
        var time = 0
        while (true) {
            emit(time)
            delay(2000)
            time++
        }
    }
}